package com.xyf.controller;

import com.seventh.common.pojo.R;
import com.xyf.pojo.entity.TbMaintainShop;
import com.xyf.pojo.vo.MaintainShopVo;
import com.xyf.service.TbMaintainShopService;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

/**
 * @program: clms-seventh
 * @description: MaintainShop控制层
 * @author: 徐亚飞
 * @create: 2021-07-23 10:13
 **/
@RestController
@RequestMapping("safeguard/maintainShop")
@ApiModel(value = "维修厂控制层" , description = "维修厂控制层")
public class TbMaintainShopController {

    @Autowired
    TbMaintainShopService tbMaintainShopService;

    @PostMapping("initMaintainShopTable/{currentPage}/{pageSize}")
    @ApiModelProperty("分页查询维修厂")
    public R findAllMaintainShopByPage(@PathVariable("currentPage")Integer currentPage,
                           @PathVariable("pageSize") Integer pageSize,
                           @RequestBody MaintainShopVo maintainShopVo
    ){

        return tbMaintainShopService.findAllMaintainShopByPage(currentPage,pageSize,maintainShopVo);
    }

    @GetMapping("selectById/{id}")
    @ApiModelProperty("根据Id查询查询维修厂")
    public TbMaintainShop selectById(@PathVariable Integer id){
        TbMaintainShop tbMaintainShop = tbMaintainShopService.selectById(id);
        return tbMaintainShop;
    }

    @PostMapping("insertMaintainShop")
    public R insertMaintainShop(TbMaintainShop tbMaintainShop){
        R r = tbMaintainShopService.insertMaintainShop(tbMaintainShop);
        return r;

    }
    @DeleteMapping("deleteById/{id}")
    public R deleteMaintainShop(@PathVariable Integer id){
        R r = tbMaintainShopService.deleteMaintainShop(id);
        return r;
    }

    @PutMapping("update")
    public R updateMaintainShop(TbMaintainShop tbMaintainShop){
        R r = tbMaintainShopService.updateMaintainShop(tbMaintainShop);
        return r;
    }
}
